<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
	<title>药品维护查看记录</title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>药品维护查看记录</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="drugList.jsp">药品库管理</a></li>
            <li class="active"><a href="#">药品维护查看记录</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
                    
                    <div class="form-group form-group-xs">
                        <label for="searchPharCode">修改日期：</label>
                        <input class="form-control" id="startTime"   name="startTime" type="text" placeholder="yyyy-MM-dd" 
                         onFocus="var endDate=$dp.$('endTime');WdatePicker({maxDate:'#F{$dp.$D(\'endTime\')}'})" />
                        <label>-</label>
                        <input class="form-control" type="text" id="endTime" name="endTime"  placeholder="yyyy-MM-dd" maxlength="10"  
                         onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')}'})" />
                    </div>
                    <a href="javascript:void(0);" onclick="searchData()" class="btn btn-success btn-sm">查&nbsp;询</a>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
	      <div class=" box box-warning bottongroup">
                <a href="${ctx}/stdDrug/list.html" class="btn btn-default btn-sm">返&nbsp;回</a>
        </div>
    </section>
   <%@ include file="/WEB-INF/component/commonJS.jsp" %>  
    <script type="text/javascript">
    
        $(function () {
            $('#addNew').click(function () {
                $('#exampleModal').modal({
                    keyboard: true
                });
            });
            $('#confirmtest').click(function () {
                $.HN.message.confirm('确定不通过吗？', '', '').on(function (e) {
                    if (e) {
                        $.HN.message.alert('操作成功！', '提示信息', 'success');
                    }
                });
            })
            $("#gridlist").jqGrid({
                url: "${pageContext.request.contextPath}/stdDrug/getDrugInfoLogList.html",
                mtype: "POST",
                postData: {
                	"drugId" : "${drugId}"
                },
                datatype: "json",
                autowidth: true,
                shrinkToFit:false,
                height: 270,
                colNames: [ 'logid','药品编码',  '通用名', '剂型', '规格','转换系数', '单位', '生产企业' , '修改人','更新日期' ,'状态','操作'],
                colModel: [
                    
                    { name: 'logId', index: 'ids',hidden:true,key:true,width:100, align: "center"},
                    { name: 'drugCode', index: 'sdate',width:100, align: "center"},
                    { name: 'drugName', index: 'name',width:130, align: "center"},
                    { name: 'formName', index: 'stock',width:100, align: "center"},
                    { name: 'specName', index: 'ship',width:100, align: "center"},
                    { name: 'factor', index: 'note',width:60, align: "center"},
                    { name: 'unit', index: 'note1',width:60, align: "center"},
                    { name: 'prodPompName', index: 'note0',width:200, align: "center"},
                    { name: 'updUser', index: 'note2',width:120, align: "center"},
                    { name: 'updDatetime', index: 'note3',width:130, align: "center"},
                    { name: 'status',width: 30, align:"center",
                    	formatter : function(val, opts,rowdata) {
							var str = "";
							if (rowdata.status == "启用") {
								str = "启用";
							} else if (rowdata.status == "停用") {
								str = "停用";
							}else if(rowdata.status == "合并"){
								str = "合并";
							}
							return str;
						}
                    },
                    { name: 'note5', index: 'note5',width:100, align: "center", formatter : function(val, opts, rowdata) {
                    	return "<a href='${pageContext.request.contextPath}/stdDrug/drugInfoLogDetail.html?Logid="+rowdata.logId+"'>详情</a>";
                    }}
                ],
                rowNum: 10,
                rowList: [10, 20, 30],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                caption: "药品维护记录",
                jsonReader: {
                    repeatitems: false,
                    id: "ids"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });
        
        function deleteId(){
      	  $.HN.message.confirm('确定作废吗？', '', '').on(function (e) {
                if (e) {
                    $.HN.message.alert('操作成功！', '提示信息', 'success');
                }
            });
        }  
        function searchData() {
        	var startTime = $("#startTime").val();
        	if (startTime.length>0){
        		startTime = startTime + " 00:00:00";
        	}
        	var endTime = $("#endTime").val();
        	if (endTime.length>0){
        		endTime = endTime + " 23:59:5";
        	}
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:{
    	        	"startTime":startTime, 
    	        	"endTime":endTime
    	        }
    	       
    	    }).trigger("reloadGrid"); //重新载入  
    	}
    </script>
</body>
</html>